package com.hps.demo.service;

import com.hps.demo.entity.User;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @author heps
 * @since 2020/7/9 16:40
 */
@Service
public class UserService {

  @Cacheable(cacheNames = "user", key = "'id:' + #id")
  public User get(Long id) {
    User user = new User();
    user.setId(id);
    user.setName("Heps");
    return user;
  }
}
